package com.nyj.sqlSession;

import java.beans.IntrospectionException;
import java.lang.reflect.InvocationTargetException;
import java.sql.SQLException;
import java.util.List;

/**
 * @author niuyj
 * @date 2020/4/30 23:15
 * @description 数据库CURD操作
 */
public interface SqlSession {

    //查询所有
    public <E> List<E> selectList(String statementId, Object... params) throws IllegalAccessException, IntrospectionException, InstantiationException, SQLException, InvocationTargetException, NoSuchFieldException;

    //查询单个
    public <T> T selectOne(String statementId, Object... params) throws IllegalAccessException, IntrospectionException, InstantiationException, SQLException, InvocationTargetException, NoSuchFieldException;

    //添加方法
    public <T> int add(String statementId, Object... params) throws NoSuchFieldException, IllegalAccessException, SQLException;

    //修改方法
    public <T> int update(String statementId, Object... params) throws NoSuchFieldException, IllegalAccessException, SQLException;

    //修改方法
    public <T> int delete(String statementId, Object... params) throws NoSuchFieldException, IllegalAccessException, SQLException;

    //定义getMapper方法，实现代理模式
    public <T> T getMapper(Class<?> mapperClass);
}
